# Contributor: Maxim Karasev <mxkrsv@disroot.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=hut
pkgver=0.4.0
pkgrel=0
pkgdesc="command-line tool for sr.ht"
url="https://sr.ht/~emersion/hut"
arch="all"
license="AGPL-3.0-only"
makedepends="go scdoc"
subpackages="$pkgname-doc
	$pkgname-zsh-completion
	$pkgname-bash-completion
	$pkgname-fish-completion"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/hut/archive/v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"
options="chmod-clean"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make GOFLAGS="$GOFLAGS" all
}

check() {
	go test ./...
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr \
		FISHCOMPDIR=/usr/share/fish/vendor_completions.d install
}

sha512sums="
447fd59d9213aad89e30e50c1a4499b9fb71b5815d524a9a36256f4f03acd3c9a7f3c08382e4bc4cf7fb6a1b55a190252b2597ac1c2309bdb3a333fc77b459dc  hut-0.4.0.tar.gz
"
